package org.example;

import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.ConfigurableEnvironment;

import java.net.InetAddress;
import java.net.UnknownHostException;

@SpringBootApplication
@Slf4j
@EnableDiscoveryClient
public class UrlShortenerGatewayAppliction {
    public static void main(String[] args) throws UnknownHostException {
        //关闭nacos的日志配置
        System.setProperty("nacos.logging.default.config.enabled", "false");
        ConfigurableApplicationContext application = SpringApplication.run(UrlShortenerGatewayAppliction.class, args);
        ConfigurableEnvironment environment = application.getEnvironment();
        String hostAddress = InetAddress.getLocalHost().getHostAddress();
        String port = environment.getProperty("server.port");
        // 打印 swagger 文档地址
        log.info("项目启动启动成功！swagger 接口文档地址: http://" + hostAddress + ":" + port + "/swagger-ui.html");

    }
}